i have a new problem after firefox 99 update. I have an extension that reads pdfs using PDFJS (version pdfjs-2.13.216). It always worked and after the last update it started to give: Error: Permission denied to access property "autoAllocateChunkSize" The same extension, with tiny changes, works in chrome normally. Below is the code:
function getAllTextPDF(urlPDF) {
return new Promise(function (resolve , reject ) {
var pdfjsLib = this['pdfjs-dist/build/pdf']; //this because of firefox
pdfjsLib.GlobalWorkerOptions.workerSrc = '//mozilla.github.io/pdf.js/build/pdf.worker.js';
var loadingTask = pdfjsLib.getDocument(urlPDF);
//** from that line it no longer enters and generates the mentioned error **
loadingTask.promise.then(function(pdf) {
var numPages = pdf._pdfInfo.numPages;
var textoFinal = '';
var pagesPromises = [];
for (var i = 0; i < numPages; i++) {
(function (pageNumber) {
pagesPromises.push(getPageText(pageNumber, pdf));
})(i + 1);
}
Promise.all(pagesPromises).then(function (pagesText) {
for (var i = 0; i < pagesText.length; i++) {
textoFinal += pagesText[i];
}
if(textoFinal.length > 0){
resolve({text: textoFinal});
loadingTask.destroy();
delete pdfjsLib;
delete loadingTask;
}
});
}, function (reason) {
// PDF loading error
reject({reason});
return 0;
});
});
}
example URL of file to read (worked normally):
blob:https://dominio.com/4db038e1-ae8d-4a15-a78f-0d9d0a182c7c
The idea of the method is simple, go through the pdf file and return all the text. However now as mentioned the error is generated. Detail that did not generate the error in version 32bit firefox, I believe it started in the last update of firefox 99.
I appreciate your help.